﻿// CapImg_Paras_Dlg.cpp: 实现文件
//

#include "pch.h"
#include "SakerProject.h"
#include "CapImg_Paras_Dlg.h"
#include "afxdialogex.h"

#include "mmFile_Paras.h"
#include "xxFileProcess.h"
#include "xxWidgetControl.h"

// CCapImg_Paras_Dlg 对话框
CCapImg_Paras_Dlg* m_CapImg_Paras;

IMPLEMENT_DYNAMIC(CCapImg_Paras_Dlg, CDialogEx)

CCapImg_Paras_Dlg::CCapImg_Paras_Dlg(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_CapImg_Paras, pParent)
{

}

CCapImg_Paras_Dlg::~CCapImg_Paras_Dlg()
{
}

void CCapImg_Paras_Dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CCapImg_Paras_Dlg, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON_Save, &CCapImg_Paras_Dlg::OnBnClickedButtonSave)
END_MESSAGE_MAP()


// CCapImg_Paras_Dlg 消息处理程序


BOOL CCapImg_Paras_Dlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	gSystemCI.SelCaptureSource = xx::InitCB(this, IDC_COMBO_CaptureSource, gSystemCI.vecCaptureSourceNames, gSystemCI.iniField, L"CaptureSource", mmFile_Paras.iniModelPath(), 0);
	gSystemTM.SelTestMode = xx::InitCB(this, IDC_COMBO_TestMode, gSystemTM.vecTestModeNames, gSystemTM.iniField, L"TestMode", mmFile_Paras.iniModelPath(), 0);

	xx::WriteCK(this, IDC_CHECK_FlipLR, gSystemCI.Flag_FlipLR);
	xx::WriteCK(this, IDC_CHECK_FlipTD, gSystemCI.Flag_FlipTD);

	xx::WriteCK(this, IDC_CHECK_SetSize, gSystemCI.Flag_SetSize);
	xx::WriteWidget(this, IDC_EDIT_SetWidth, gSystemCI.SetWidth);
	xx::WriteWidget(this, IDC_EDIT_SetHeight, gSystemCI.SetHeight);
	xx::WriteWidget(this, IDC_EDIT_CURRENT_LIMIT, gSystemCI.capCurrentLimit);

	return TRUE;
}


void CCapImg_Paras_Dlg::OnBnClickedButtonSave()
{
	gSystemCI.SelCaptureSource = xx::DefaultCB(this, IDC_COMBO_CaptureSource, gSystemCI.iniField, L"CaptureSource", mmFile_Paras.iniModelPath(), 0);
	gSystemTM.SelTestMode = xx::DefaultCB(this, IDC_COMBO_TestMode, gSystemTM.iniField, L"TestMode", mmFile_Paras.iniModelPath(), 0);
	gSystemCI.Flag_FlipLR = xx::DefaultCK(this, IDC_CHECK_FlipLR, gSystemCI.iniField, L"Flip_LR", mmFile_Paras.iniModelPath());
	gSystemCI.Flag_FlipTD = xx::DefaultCK(this, IDC_CHECK_FlipTD, gSystemCI.iniField, L"Flip_TD", mmFile_Paras.iniModelPath());

	gSystemCI.Flag_SetSize = xx::DefaultCK(this, IDC_CHECK_SetSize, gSystemCI.iniField, L"SetSize", mmFile_Paras.iniModelPath());
	gSystemCI.SetWidth = xx::DefaultWidget(this, IDC_EDIT_SetWidth, gSystemCI.iniField, L"SetWidth", mmFile_Paras.iniModelPath(), 0);
	gSystemCI.SetHeight = xx::DefaultWidget(this, IDC_EDIT_SetHeight, gSystemCI.iniField, L"SetHeight", mmFile_Paras.iniModelPath(), 0);
	gSystemCI.capCurrentLimit = xx::DefaultWidget(this, IDC_EDIT_CURRENT_LIMIT, gSystemCI.iniField, L"capCurrentLimit", mmFile_Paras.iniModelPath(), 0.0);
	
}
